﻿using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Shape.Mvp.Commands;
using System.IO;
using System.Reflection;

namespace Shape.Mvp.Ioc.Installers
{
   public class CommandInstaller : IWindsorInstaller
   {
      public void Install(IWindsorContainer container, IConfigurationStore store)
      {
         container.Register(Classes.FromAssemblyInDirectory(new AssemblyFilter(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
                           .BasedOn(typeof(ICommand), typeof(ICommand<>))
                           .WithServiceSelf()
                           .LifestyleTransient());
      }
   }
}
